<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head th:replace="fragment_base::head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>博客-分类-编辑</title>
    <link rel="stylesheet"
          href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
    <link rel="stylesheet" href="../../static/css/common.css">
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"></script>
    <script src="../../static/js/custom.js"></script>
    <script src="../../static/js/semantic.min.js"></script>
</head>
<body>
<!--导航-->
<nav th:replace="admin/fragment_manager::menu(1)">
    class="ui inverted attached segment head-tab-padding">
    <div class="ui container">
        <!--stackable 表示可堆叠，自适应-->
        <div class="ui inverted secondary stackable menu">
            <h2 class="ui teal header item">管理后台</h2>
            <a class="active menu-item item mobile-hide" href="#"><i
                    class="teal code icon"></i>博客</a>
            <a class="menu-item item mobile-hide" href="#"><i class="teal idea icon"></i>分类</a>
            <a class="menu-item item mobile-hide" href="#"><i class="teal tags icon"></i>标签</a>
            <div class="right menu-item  mobile-hide menu">
                <div class="ui dropdown item">
                    <div class="text">
                        <img class="ui circular image"
                             src="http://xxstudy.cn/media/img/avatar_15.png"
                             style="vertical-align:middle">唐人
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="#" class="item">注销</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--菜单按钮-->
    <a id="menu-toggle" class=" ui black icon button bar-position mobile-show" href="#">
        <i class="sidebar icon"></i>
    </a>
</nav>

<!--列表-->
<div class="ui attached pointing menu">
    <div class="ui container">
        <div class="right menu">
            <a class="item teal active" th:href="@{/admin/category/create}">新增</a>
            <a class="item" th:href="@{/admin/category}">列表</a>
        </div>
    </div>
</div>


<!--中间内容-->
<div class="center-padding">
    <div class="ui container">
        <form action="#" method="post" th:object="${category}"  class="ui form"
              th:action="*{id}==null?@{/admin/category/create}:@{/admin/category/{categoryName}(categoryName=*{categoryName})}">
            <input type="hidden" name="id" th:value="*{id}">
            <div class="field">
                <div class="ui left labeled input">
                    <div class="ui teal basic label">名称</div>
                    <!--URL-->
                    <input type="text" name="categoryName" placeholder="分类名称" th:value="*{categoryName}">
                </div>
            </div>

            <div class="ui error message"></div>
            <div class="ui negative message" th:if="${#fields.hasErrors('categoryName')}">
                <i class="close icon"></i>
                <div class="header">操作失败</div>
                <p th:errors="*{categoryName}"></p>
            </div>

            <div class="ui message" th:unless="${msg==null}" th:classappend="${msg.success}?'success':'error'">
                <i class="close icon"></i>
                <div class="header">提示</div>
                <p th:text="${msg.msg}">操作成功</p>
            </div>

            <div class="ui container right aligned">
                <button class="ui button" type="button" onclick="window.history.go(-1)">返回</button>
                <button id="push-category-btn" class="ui teal button">提交</button>
            </div>
        </form>
    </div>
</div>

<script src="../../static/js/category-verify.js" th:src="@{/js/category-verify.js}"></script>
</body>
</html>